
//
//  GPNavBar.m
//  GPFM
//
//  Created by 郭鹏 on 2018/3/2.
//  Copyright © 2018年 郭鹏. All rights reserved.
//

#import "GPNavBar.h"

@implementation GPNavBar
+ (void)setGlobalBackGroudImage:(UIImage *)globalImage
{
    
    UINavigationBar *navBar = [UINavigationBar appearanceWhenContainedInInstancesOfClasses:@[NSClassFromString(@"GPNavigationController")]];
    
    [navBar setBackgroundImage:globalImage forBarMetrics:UIBarMetricsCompact];
}
+ (void)setGlobalTextColor:(UIColor *)globalTextColor textFontSize:(CGFloat)fontSize
{
    if (globalTextColor == nil) {
        return;
    }
    if (fontSize < 6 || fontSize > 40) {
        fontSize = 16;
    }
    UINavigationBar *navBar = [UINavigationBar appearanceWhenContainedInInstancesOfClasses:@[NSClassFromString(@"GPNavigationController")]];
    // 设置导航栏颜色
    NSDictionary *titleDic = @{
                               NSForegroundColorAttributeName: globalTextColor,
                               NSFontAttributeName: [UIFont systemFontOfSize:fontSize]
                               };
    [navBar setTitleTextAttributes:titleDic];
}
@end
